package aer.MenorNumeroMismaSumaDigitos;

import java.util.*;

public class Prueba {
	private static int[] c = new int[1000];

	public static void main(String[] args) {

		for (int i = 19; i <= 10000000; i+=10) {
			programa(i);
		}

		for (int i = 1; i < 1000; i++) {
			System.out.println(i + " " + c[i]);
		}

	}

	private static void programa(int i) {
		String s = i + "";
		int sum = 0;
		for (int j = 0; j < s.length(); j++) {
			sum += s.charAt(j) - '0';
		}

		if (c[sum] == 0 || c[sum] > i) {
			c[sum] = i;
		}
	}

}
